﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;

namespace LibraryManager
{
    public partial class TraCuuSach : Form
    {
        public TraCuuSach()
        {
            InitializeComponent();
        }

        private void TraCuuSach_Load(object sender, EventArgs e)
        {
            Loai.Items.Add("A");
            Loai.Items.Add("B");
            Loai.Items.Add("C");
            Loai.Items.Add("Tất cả");
            Loai.Text = "Tất cả";
        }

        private void TraCuu_Click(object sender, EventArgs e)
        {
            int i;
            List<TraCuuSachDTO> ListBook = new List<TraCuuSachDTO>();
            TraCuuSachDTO dk = new TraCuuSachDTO();

            dk.Tensach = Tua.Text;
            dk.Theloai = Loai.Text;
            dk.Tacgia = TG.Text;

            DanhSach.Rows.Clear();

            ListBook = TraCuuSachBUS.TraCuuSach(dk);
            
            for (i = 0; i < ListBook.Count; i++)
                DanhSach.Rows.Add(ListBook[i].Masach, ListBook[i].Tensach, ListBook[i].Theloai, ListBook[i].Tacgia, ListBook[i].SL);
        }
    }
}
